Let's say that we've created our model.
Now we have our K and N dot predict function that we can now run whenever we want to.
Perhaps use, let's say a user inputs a whole new photo that we haven't seen before of an iris flower.
And we want to predict what that flower type is.
How can we do that?
Well, let's create a new variable here.
Let's say sample equals and create our own sample data.
If we go to our.
Data over here.
We see that the data set over here has.
One, two, three, four parameters.
So this is an array that contains 5.1, then 3.5, 1.4 and 0.2.
So let's just enter some numbers here.
Let's say that here we have three, then five, then four, then two.
And then the second image has a parameter of two and three and five and four.
So that's our sample data.
We can now give our can predict function, which is our model.
The sample data.
So let's say that's going to equal the predictions variable.
And let's just do something neat with some list comprehension here.
We'll say that the predicted species is going to equal the iris dot.
Target.
Names.
P.
For PPI, which is the variable that we create in the predictions.
So I'm just using a little nice shorthand Python syntax to hopefully give us the prediction answers.
So let's say print and then our predictions.
Is going to be the predict.
Species.
So that if I run this.
Oops.
What did I mess up here?
Tiger names, not tiger names.
Target names.
Let's run that again.
There you go.
These are my predictions.
So the first one is very color.
The second one was predicted to be Virginia.
Well, it's hard to say if it's right or wrong.
Right.
That's why we have a test data set so that we know the answer to these questions.
Ideally, we have a human label these so that we can test and see if this was right or wrong.
Right now, we don't know if it's right or wrong, but at least we know that it's making predictions
and it's making predictions at a 96% accuracy based on our Y test data.
Very, very cool.